import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

import path from 'path'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import ElementPlus from 'unplugin-element-plus/vite'

export default defineConfig({
	base: './',
	// publicPath: "./",
	plugins: [
		vue(),
		// 按需引入，主题色的配置，需要加上 importStyle: 'sass'
		Components({
			resolvers: [ElementPlusResolver({
				importStyle: 'sass'
			})],
		}),
		// ElementPlus()
	],
	resolve: {
		alias: {
			'~': path.resolve(__dirname, './'),
			'@': path.resolve(__dirname, 'src')
		},
	},
	server: {
		open: true,
    host: false,
    port: '3004',
    https: false,
    hotOnly: false,
		proxy: {
			'/etcm': {
			  // target: 'http://192.168.5.24:8090/', 
			  // target: 'http://192.168.101.8:8087/', 
				// target: 'http://192.168.6.232:8443/',
				target: 'http://localhost:8087/',
			  changeOrigin: true,
			  secure: true,
			  // rewrite: path => path.replace(/^\/api/, '') // 重写 api 为 空，就是去掉它
			}
		}
	}
})
